﻿Imports CommonServiceLocator
Imports GalaSoft.MvvmLight.Ioc

Namespace FL_8x0.Viewmodel

    Public Class ViewModelLocator
        ''' <summary>
        ''' Initializes a new instance of the ViewModelLocator class.
        ''' </summary>
        Public Sub New()
            ServiceLocator.SetLocatorProvider(Function() SimpleIoc.Default)

            '//if (ViewModelBase.IsInDesignModeStatic)
            '//{
            '//    // Create design time view services and models
            '//    SimpleIoc.Default.Register<IDataService, DesignDataService>();
            '//}
            '//else
            '//{
            '//    // Create run time view services and models
            '//    SimpleIoc.Default.Register<IDataService, DataService>();
            '//}

            SimpleIoc.Default.Register(Of MainViewModel)()
            SimpleIoc.Default.Register(Of FL_830.ViewModel.LeakTestViewModel)()
            SimpleIoc.Default.Register(Of FL_800.ViewModel.LeakTestViewModel)()
        End Sub

        Public ReadOnly Property Main() As MainViewModel
            Get
                Return ServiceLocator.Current.GetInstance(Of MainViewModel)()
            End Get
        End Property

        Public ReadOnly Property LeakTest830() As FL_830.ViewModel.LeakTestViewModel
            Get
                Return ServiceLocator.Current.GetInstance(Of FL_830.ViewModel.LeakTestViewModel)()
            End Get
        End Property

        Public ReadOnly Property LeakTest800() As FL_800.ViewModel.LeakTestViewModel
            Get
                Return ServiceLocator.Current.GetInstance(Of FL_800.ViewModel.LeakTestViewModel)()
            End Get
        End Property


        Public Shared Sub Cleanup()
            ' TODO Clear the ViewModels
        End Sub

    End Class
End Namespace